package com.wlr.study.leetcode;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Stack;

public class LeetCode155 {
    Stack<Integer> arr;
    Stack<Integer> minStack;

    public LeetCode155() {
        arr = new Stack<>();
    }

    public void push(int val) {
        arr.push(val);
        minStack.push(Math.min(minStack.peek(), val));
    }

    public void pop() {
        arr.pop();
        minStack.pop();
    }

    public int top() {
        return arr.peek();
    }

    public int getMin() {
        return minStack.peek();
    }
}
